package o;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import com.huawei.appgallery.appcomment.ui.thirdcomment.ThirdDialogResultActivity;
import java.lang.reflect.Field;
import o.bcg.d;
import o.bcg.e;
import o.bcg.h;
import o.bch.a;

public class beh extends cku {
    private String ʻॱ;
    private String ʼॱ;
    private String ʽॱ;
    private String ʾ;
    private String ʿ = null;
    private String ˈ;
    private bem ˉ;
    private float ˊˊ = 0.0f;
    private int ˊˋ;
    private int ˊॱ = 0;
    private Float ˋˊ = null;
    private TextView ͺ;
    public boolean ॱ = false;
    private ImageView ॱˊ;
    private RatingBar ॱˋ;
    private String ॱˎ;
    private TextView ॱᐝ;
    private String ᐝॱ;

    public Dialog onCreateDialog(Bundle bundle) {
        return ᐝ();
    }

    public void onStart() {
        super.onStart();
        if (this.ॱˋ != null && this.ॱˋ.getRating() == 0.0f) {
            Button button = ((AlertDialog) getDialog()).getButton(-1);
            button.setAlpha(0.38f);
            button.setClickable(false);
        }
    }

    private Dialog ᐝ() {
        Builder builder = new Builder(getActivity());
        View inflate = getActivity().getLayoutInflater().inflate(d.ʼॱ, null);
        ˏ(inflate);
        this.ॱˊ = (ImageView) inflate.findViewById(e.ʿᐝ);
        this.ͺ = (TextView) inflate.findViewById(e.ˈˊ);
        this.ॱᐝ = (TextView) inflate.findViewById(e.ˆ);
        this.ॱˋ = (RatingBar) inflate.findViewById(e.ˉˊ);
        eqx.ˏ(this.ॱˊ, this.ᐝॱ, "app_default_icon");
        this.ͺ.setText(getActivity().getString(h.ॱᐧ, new Object[]{this.ʻॱ}));
        this.ॱᐝ.setText(getActivity().getString(h.ॱᐨ, new Object[]{ber.ˋ(getActivity(), getActivity().getPackageName())}));
        builder.setView(inflate);
        OnClickListener o_bef = new bef(this);
        builder.setPositiveButton(h.ॱʻ, o_bef);
        builder.setNegativeButton(h.ᐝʼ, o_bef);
        this.ˊॱ = 1;
        this.ॱˋ.setOnRatingBarChangeListener(new bej(this));
        builder.setOnKeyListener(new bee(this));
        Dialog create = builder.create();
        ayw.ˊ(create.getWindow());
        return create;
    }

    public void ॱ() {
        AlertDialog alertDialog = (AlertDialog) getDialog();
        if (alertDialog != null) {
            Button button = alertDialog.getButton(-1);
            Button button2 = alertDialog.getButton(-2);
            this.ͺ.setText(getActivity().getString(h.ॱˑ));
            this.ॱᐝ.setText(getActivity().getString(h.ॱˍ));
            button.setText(getActivity().getString(h.ॱـ));
            button2.setText(getActivity().getString(h.ॱˌ));
            this.ˊˊ = ˏ();
            this.ˊॱ = 2;
            ˋ(false);
            ˋ("score/2");
        }
    }

    public void ˋ(boolean z) {
        boolean z2 = true;
        try {
            AlertDialog alertDialog = (AlertDialog) getDialog();
            if (alertDialog != null && alertDialog.getClass().getSuperclass() != null) {
                Field declaredField = alertDialog.getClass().getSuperclass().getDeclaredField("mShowing");
                declaredField.setAccessible(true);
                if (z) {
                    z2 = false;
                }
                declaredField.set(alertDialog, Boolean.valueOf(z2));
            }
        } catch (SecurityException e) {
            Logger.ˋ("ThirdCommentDialog", "changeDismissStatus:" + e.toString());
        } catch (IllegalArgumentException e2) {
            Logger.ˋ("ThirdCommentDialog", "changeDismissStatus:" + e2.toString());
        } catch (NoSuchFieldException e3) {
            Logger.ˋ("ThirdCommentDialog", "changeDismissStatus:" + e3.toString());
        } catch (IllegalAccessException e4) {
            Logger.ˋ("ThirdCommentDialog", "changeDismissStatus:" + e4.toString());
        }
    }

    private void ˏ(View view) {
        try {
            int ˎ = ewb.ˎ((Activity) view.getContext());
            view.setPadding(ˎ, ˎ, ˎ, 0);
        } catch (Exception e) {
            Logger.e("ThirdCommentDialog", e.toString());
        }
    }

    public void ˋ(Bundle bundle) {
        if (bundle != null) {
            this.ʻॱ = bundle.getString("APP_NAME");
            this.ᐝॱ = bundle.getString("APP_ICON");
            this.ʾ = bundle.getString("PACKAGE_NAME");
            this.ॱˎ = bundle.getString("APP_ID");
            this.ʼॱ = bundle.getString("VERSION_NAME");
            this.ˈ = bundle.getString("VERSION_CODE");
            this.ʽॱ = bundle.getString("COMMENT_ID");
            this.ʿ = bundle.getString("COMMENT_CONTENT");
            this.ˋˊ = Float.valueOf(bundle.getFloat("COMMENT_RATING"));
            this.ˊˋ = bundle.getInt("LIST_ID");
        }
    }

    public void ˊ() {
        if (bmt.ˊ(getActivity())) {
            bcb.ˋ.ˋ("ThirdCommentDialog", "publish the score of third app");
            cvt o_bcr = new bcr(this.ʼॱ);
            o_bcr.ˊ(this.ॱˎ);
            o_bcr.ʼ(this.ʽॱ);
            if (this.ॱˋ != null) {
                o_bcr.ॱ(String.valueOf(this.ॱˋ.getRating()));
            }
            o_bcr.ॱ(this.ˊˋ);
            o_bcr.setServiceType_(cdh.ˎ(getActivity()));
            if (this.ˊॱ == 1) {
                cfw.ˎ(o_bcr, new bdk(this));
                return;
            } else if (this.ˊॱ == 2) {
                cfw.ˎ(o_bcr, null);
                ˋ("score/3");
                ʻ().ˏ(102);
                return;
            } else {
                return;
            }
        }
        ckv.ˎ(getString(h.ᐝʽ), 0);
        ˋ(true);
    }

    public void ˎ() {
        if (bmt.ˊ(getActivity())) {
            bcb.ˋ.ˋ("ThirdCommentDialog", "Jump to CommentActivity");
            ˋ(0);
            ˋ(false);
            ˋ("score/4");
            this.ˋˊ = Float.valueOf(ˏ());
            a aVar = new a();
            aVar.ˏ(this.ʻॱ);
            aVar.ˋ(this.ॱˎ);
            aVar.ˎ(this.ᐝॱ);
            aVar.ॱ(this.ʾ);
            aVar.ˊ(this.ˈ);
            aVar.ॱॱ(String.valueOf(this.ˋˊ));
            aVar.ʼ(this.ʿ);
            aVar.ʻ(this.ʽॱ);
            aVar.ˋ(this.ˊˋ);
            bco o_bco = new bco();
            o_bco.ˏ(true);
            o_bco.ॱ(getActivity(), aVar.ˋ());
            return;
        }
        ckv.ˎ(getString(h.ᐝʽ), 0);
        ˋ(true);
    }

    public void ˋ(String str) {
        bel.ˎ(getActivity(), this.ॱˎ, str);
    }

    public boolean ˋ() {
        if (Math.abs(ˏ() - this.ˊˊ) < 1.0E-7f) {
            return false;
        }
        return true;
    }

    public float ˏ() {
        if (this.ॱˋ != null) {
            return this.ॱˋ.getRating();
        }
        return 0.0f;
    }

    public void ˋ(int i) {
        this.ˊॱ = i;
    }

    public int ʼ() {
        return this.ˊॱ;
    }

    public void ˎ(boolean z) {
        this.ॱ = z;
    }

    public boolean ʽ() {
        return this.ॱ;
    }

    public void ˎ(bem o_bem) {
        this.ˉ = o_bem;
    }

    public bem ʻ() {
        if (this.ˉ == null) {
            this.ˉ = new ThirdDialogResultActivity();
        }
        return this.ˉ;
    }
}
